/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package collision;

/**
 *
 * @author marinacv
 */
public class SelectPokemon {
    private int pkm;
    private int XTAM;
    private int h;
    private int k;
    private int XBEGIN;
    private int XEND;
    private int YBEGIN;
    private int YEND;
    private int NUMCOL;

    public Pokemon getPoke(int x, int y) {

        if(this.pkm == 0){
                poke =  new Pokemon(x, y);
                System.out.println("Pikachu");
            }
            if(this.pkm == 1){
                poke = new Bulbasaur(x, y);
                System.out.println("Bulba");
            }
            if(this.pkm == 2){
                poke = new Charmander(x, y);
                System.out.println("Char");
            }
            if(this.pkm == 3){
                poke = new Squirtle(x, y);
                System.out.println("Squirtle");
            }

        return poke;
    }


    private Pokemon poke;

    public SelectPokemon(){
        this.pkm = 0;
        this.XTAM = 70;
        this.h = 89;
        this.k = 12;
        this.XBEGIN = 147;
        this.XEND = 455;
        this.YEND = 205;
        this.YBEGIN = 120;
        this.NUMCOL= 4;

    }

    public int findCol(int x){

        if( x < XBEGIN || x > XEND )
            return -1;

        x = x - XBEGIN;

        for(int i = 0; i < NUMCOL; i++){
            if(x < (i*(XTAM))) return -1;
            if(x > (i*XTAM) && x < ((i*XTAM)+ XTAM + k)) return i;
        }
        return -1;
    }

    public int findRow(int y){

        if(y < YBEGIN || y > YEND )
            return -1;

        y = y - YBEGIN;

        return 1;
    }

    public void selecting(int x, int y){

        if(this.findRow(y) != -1){
            pkm = this.findCol(x);
            }

    }


    }